/**
 * <p>功能:系统管理模块-系统监控-异常日志 <p>
 * @extends Wys.basic.BaseView
 * @author wys
 */
Ext.define('Jason.view.protal.module.systemManager.monitor.exception.MainView', {
    extend: 'Wys.basic.BaseView',
    xtype: 'systemManager_exception_operationView',
    itemId: 'systemManager_exception_operationView',
    requires: [
        'Jason.store.ReqUrl',
        'Ext.grid.plugin.RowExpander',
        'Jason.view.protal.module.systemManager.monitor.ViewModel',
        'Jason.store.protal.module.systemManager.monitor.log.ErrorLogsStore'
    ],
    viewModel: { type: 'monitor_login_ViewModel' },
    enabledRightMenu: true,
    enabledMark: false,
    bind: '{sysErrorLogsStore}',
    listeners: {
        afterrender: function (grid) {
            Ext.defer(function () {
                var store = Ext.StoreManager.lookup('sysErrorLogsStore');
                store.load();
            }, 100);
        }
    },
    plugins:[{
        ptype : 'rowexpander',
        rowBodyTpl : new Ext.XTemplate(
            '<div style="background: #FFFFFF;padding: 8px 8px 8px 85px;">',
                '<p><b style="font-weight: bold;">请求方法:</b>{methodClass}</p>',
                '<p><b style="font-weight: bold;">请求参数:</b>{params}</p>',
                '<p><b style="font-weight: bold;">用户代理:</b>{userAgent}</p>',
                '<p><b style="font-weight: bold;">异 常 名:</b>{errorName}</p>',
                '<p><b style="font-weight: bold;">异常信息:</b>{errorMessage}</p>',
                '<p><b style="font-weight: bold;">异常行数:</b>{errorLineNumber}</p>',
                '<p><b style="font-weight: bold;">异常文件:</b>{errorFileName}</p>',
                '<p><b style="font-weight: bold;">堆栈信息:</b>{stackInfo}</p>',
            '</div>'
            )
    }],
    columns: [
        { xtype: 'rownumberer', text: '序号', align: 'center', width: 50 },
        { text: '应用名', dataIndex: 'appName', flex: .2, menuDisabled: true },
        { text: '服务名', dataIndex: 'serverName'},
        { text: '运行环境', dataIndex: 'env', width:80, menuDisabled: true },
        { text: '请求IP',dataIndex:'visitorIp',width:100,},
        { text: '请求URI',dataIndex:'requestUri',flex:.4},
        { text: '请求方式', dataIndex:'requestMethod',width:80},
        { text: '异常时间',dataIndex:'createTime', xtype: 'datecolumn', format: 'Y-m-d H:i', width: 130 }
    ],
    dockedItems: [{
        xtype: 'pagingtoolbar',
        bind: 'sysErrorLogsStore',
        enabledMoreOpt: true,
        dock: 'bottom'
    }, {
        xtype: 'toolbar',
        dock: 'top',
        items: [{
            xtype: 'gridsearchfield',paramName:'requestUri'
        }, '->', {
            xtype: 'exportbutton', rightCode: 'ZX_LOGS',
            modularText: '系统运行错误日志'
        },{
            xtype: 'refresh', viewItemId: '#systemManager_exception_operationView',
            rightCode: 'ZX_LOGS'
        }
        ]
    }, {
        xtype: 'useFilter',
        hidden: true,
        filterscheme: {
            details: [{
                details: [{
                    defaulttitle: "执行人",
                    fieldname: "operationuser"
                }, {
                    defaulttitle: "执行时间",
                    isDateField: true,
                    fieldname: "operationdate"
                }, {
                    defaulttitle: "执行内容",
                    isDateField: true,
                    fieldname: "operationdate"
                }]
            }]
        },
        dock: 'top'
    }]
});